require(['loading'], function(loading) {
	//获取url中的id参数
	var params = getUrlParams();
	var classId = params.classId?params.classId:"";
	//应用实例化
	var releaseSuccess = new Vue({
		el: '#releaseSuccess',
		data: {
			goodsList: [],
			showLoading: false,
			apiUrl: wxUrl + '/v3.3/tbuyingInfo/recommend',
			item: {
				params:{
					token: token,
					userToken: userToken,
					classId: classId
				}
			}
		},
		ready: function() {
			this.getGoodsList();
	    },
		methods: {
			getGoodsList: function() {
				this.$http.get(this.apiUrl, this.item)
					.then(function(response) {
						var result = JSON.parse(response.body);
						console.log(result)
						if(result.data.buyList.length > 0){
							this.goodsList = this.goodsList.concat(result.data.buyList);
							if(result.data.buyList.length >= 6){
								$(".more").css("display","block");
							}
						} else {
							$('.wutuijian').show();
						}
					},function(response) {
						
					});
			}
		}
	});
	// 为可控制返回指定页面所有添加pushState
	history.pushState({}, document.title, null);
	pushVHistory("../sales/wholesale_management.html");
	window.addEventListener("popstate", function() {
	    // 跳转到批发商品管理列表页面
		goBackVHistory();
	});
});